package one.bugu.android.demon.ui.adapter.snatch;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Description FragmentAdapter viewpager嵌套fragment适配器
 *
 * @author liuxin
 * @date 2018/10/26 14:10
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    //存放fragment的集合
    private List<Fragment> mFragments;

    public FragmentAdapter(FragmentManager fm, List<Fragment> mFragments) {
        super(fm);
        this.mFragments = mFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        //删除super 解决viewpager切换时页面显示问题
    }
}
